package kiec.iss.dvc.checker;

import tradesign.pki.asn1.AlgorithmID;

public class CheckManager {

	
	public boolean checkOID(AlgorithmID hashAlgo, String oid) {
		
		if (hashAlgo.equals(AlgorithmID.sha256)) {
			if (oid.equals(AlgorithmID.sha256.getOID()))
				return true;
			else 
				return false;
		} else if (hashAlgo.equals(AlgorithmID.sha1)) {
			if (oid.equals(AlgorithmID.sha1.getOID()))
				return true;
			else 
				return false;
		} else {
			return false;
		}
		
	}
	
	
	
	public boolean checkHashedValue(byte[] byHash1, byte[] byHash2) {

		if (byHash1 == null) {
			if (byHash2 == null)
				return true;
			else
				return false;
		}
		if ((byHash1 == null) || (byHash2 == null))
			return false;

		if (byHash1.length != byHash2.length)
			return false;

		for (int i = 0; i < byHash1.length; i++) {
			if (byHash1[i] != byHash2[i])
				return false;
		}
		return true;

	}	
	
}
